<!--  -->
<template>
  <div class="wrapper" ref="wrapper">
     <div>
       <slot></slot>
     </div>
  </div>
</template>

<script>
import BScroll from 'better-scroll'


export default {
  data () {
    return {
        bscroll:null
    }
  },
  mounted() {
      this.bscroll = new BScroll(this.$refs.wrapper,{
        click:true,
        probeType:this.probeType,
        pullUpLoad:this.pullUpLoad
         
      })
      // this.bscroll.scrollTo(0,0)
      this.bscroll.on('scroll',(position) => {
        // console.log(position);
        this.$emit('scroll',position)
      })
      this.bscroll.on('pullingUp',() => {
        this.$emit('pullingUp')
      })
  },
  props:{
    probeType:{
      type:Number,
      default:0
    },
    pullUpLoad:{
      type:Boolean,
      default:false
    }
  },
  methods:{
    refresh() {
      this.bscroll && this.bscroll.refresh()
    },
    scrollTo(x,y,delay=300) {
      this.bscroll && this.bscroll.scrollTo(x,y,delay)
    }
  }
}



</script>

<style  scoped>

</style>
